$(document).ready(function() {

	Calendar.setup({
		inputField : "createDate",
		trigger : "createDate",
		onSelect : function() {
			this.hide()
		},
		onChange : function() {
			this.setHours(new Date().getHours());
			this.setMinutes(new Date().getMinutes());
		},
//		onBlur : function() {   //chrome，safari失效，因为onBlur不是标准的W3C Attribute
//			alert('abcde');   
//		},
		min : 10000101,
		max : 29991231,
		showTime : 24,
		minuteStep : 1,
		dateFormat : "%Y-%m-%d %H:%M"
	});

	$('#submit').click(function() {
		var operation = $('#operation').val();
		$.ajax({
			url : contextPath + '/omArea/save',
			data : $('#form').serialize(),
			type : 'POST',
			dataType : 'json',
			success : function(result) {
				if (result.success == true) {
					if (result.operation == 'add') {
						alert('新增成功！');
					}
					if (result.operation == 'edit') {
						alert('修改成功！');
					}
					window.returnValue = true;
					window.close();
				}
			}
		});
		return false;
	});

});